import request from "../utils/http";

// 获取日志列表  GET /dailyLogs
export function getDailyLogList(params) {
  return request({
    url: "/dailyLogs",
    method: "get",
    params: params,
  });
}

// 获取核心统计数据  GET /dailyLogs/stats
export function getDailyCoreStats(params) {
  return request({
    url: "/dailyLogs/stats",
    method: "get",
    params: params,
  });
}

// 根据日期获取当日食材成本  GET /dailyLogs/costs/:log_date
export function getDailyFoodCosts(logDate) {
  return request({
    url: `/dailyLogs/costs/${logDate}`,
    method: "get",
  });
}

// 获取单个日志详情  GET /dailyLogs/:id
export function getDailyLogDetail(id) {
  return request({
    url: `/dailyLogs/${id}`,
    method: "get",
  });
}

// 新增日志  POST /dailyLogs
export function addDailyLog(data) {
  return request({
    url: "/dailyLogs",
    method: "post",
    data: data,
  });
}

// 更新日志信息  PUT /dailyLogs/:id
export function updateDailyLog(id, data) {
  return request({
    url: `/dailyLogs/${id}`,
    method: "put",
    data: data,
  });
}

// 删除日志  DELETE /dailyLogs/:id
export function deleteDailyLog(id) {
  return request({
    url: `/dailyLogs/${id}`,
    method: "delete",
  });
}
